package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(org.gap.domain.TiersModifPK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllTiersModifs", query = "select myTiersModif from TiersModif myTiersModif"),
		@NamedQuery(name = "findTiersModifByPrimaryKey", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoTiers = ?1 and myTiersModif.tmoNomChampModif = ?2 and myTiersModif.tmoDateModification = ?3"),
		@NamedQuery(name = "findTiersModifByTmoAncienneVal", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoAncienneVal = ?1"),
		@NamedQuery(name = "findTiersModifByTmoAncienneValContaining", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoAncienneVal like ?1"),
		@NamedQuery(name = "findTiersModifByTmoDateModification", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoDateModification = ?1"),
		@NamedQuery(name = "findTiersModifByTmoDateModificationAfter", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoDateModification > ?1"),
		@NamedQuery(name = "findTiersModifByTmoDateModificationBefore", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoDateModification < ?1"),
		@NamedQuery(name = "findTiersModifByTmoNomChampModif", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoNomChampModif = ?1"),
		@NamedQuery(name = "findTiersModifByTmoNomChampModifContaining", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoNomChampModif like ?1"),
		@NamedQuery(name = "findTiersModifByTmoNouvelleVal", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoNouvelleVal = ?1"),
		@NamedQuery(name = "findTiersModifByTmoNouvelleValContaining", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoNouvelleVal like ?1"),
		@NamedQuery(name = "findTiersModifByTmoTiers", query = "select myTiersModif from TiersModif myTiersModif where myTiersModif.tmoTiers = ?1") })
@Table(schema = "GAP", name = "TIERS_MODIF")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "TiersModif")
public class TiersModif implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "TMO_TIERS", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer tmoTiers;
	/**
	 */

	@Column(name = "TMO_NOM_CHAMP_MODIF", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String tmoNomChampModif;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "TMO_DATE_MODIFICATION", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Calendar tmoDateModification;
	/**
	 */

	@Column(name = "TMO_ANCIENNE_VAL", length = 50)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tmoAncienneVal;
	/**
	 */

	@Column(name = "TMO_NOUVELLE_VAL", length = 50)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String tmoNouvelleVal;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "TMO_USER_MODIFICATION", referencedColumnName = "USR_USER", nullable = false) })
	@XmlTransient
	Utilisateurs utilisateurs;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "TMO_TIERS", referencedColumnName = "TIE_TIERS", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Tiers tiers;

	/**
	 */
	public void setTmoTiers(Integer tmoTiers) {
		this.tmoTiers = tmoTiers;
	}

	/**
	 */
	public Integer getTmoTiers() {
		return this.tmoTiers;
	}

	/**
	 */
	public void setTmoNomChampModif(String tmoNomChampModif) {
		this.tmoNomChampModif = tmoNomChampModif;
	}

	/**
	 */
	public String getTmoNomChampModif() {
		return this.tmoNomChampModif;
	}

	/**
	 */
	public void setTmoDateModification(Calendar tmoDateModification) {
		this.tmoDateModification = tmoDateModification;
	}

	/**
	 */
	public Calendar getTmoDateModification() {
		return this.tmoDateModification;
	}

	/**
	 */
	public void setTmoAncienneVal(String tmoAncienneVal) {
		this.tmoAncienneVal = tmoAncienneVal;
	}

	/**
	 */
	public String getTmoAncienneVal() {
		return this.tmoAncienneVal;
	}

	/**
	 */
	public void setTmoNouvelleVal(String tmoNouvelleVal) {
		this.tmoNouvelleVal = tmoNouvelleVal;
	}

	/**
	 */
	public String getTmoNouvelleVal() {
		return this.tmoNouvelleVal;
	}

	/**
	 */
	public void setUtilisateurs(Utilisateurs utilisateurs) {
		this.utilisateurs = utilisateurs;
	}

	/**
	 */
	public Utilisateurs getUtilisateurs() {
		return utilisateurs;
	}

	/**
	 */
	public void setTiers(Tiers tiers) {
		this.tiers = tiers;
	}

	/**
	 */
	public Tiers getTiers() {
		return tiers;
	}

	/**
	 */
	public TiersModif() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(TiersModif that) {
		setTmoTiers(that.getTmoTiers());
		setTmoNomChampModif(that.getTmoNomChampModif());
		setTmoDateModification(that.getTmoDateModification());
		setTmoAncienneVal(that.getTmoAncienneVal());
		setTmoNouvelleVal(that.getTmoNouvelleVal());
		setUtilisateurs(that.getUtilisateurs());
		setTiers(that.getTiers());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("tmoTiers=[").append(tmoTiers).append("] ");
		buffer.append("tmoNomChampModif=[").append(tmoNomChampModif).append("] ");
		buffer.append("tmoDateModification=[").append(tmoDateModification).append("] ");
		buffer.append("tmoAncienneVal=[").append(tmoAncienneVal).append("] ");
		buffer.append("tmoNouvelleVal=[").append(tmoNouvelleVal).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((tmoTiers == null) ? 0 : tmoTiers.hashCode()));
		result = (int) (prime * result + ((tmoNomChampModif == null) ? 0 : tmoNomChampModif.hashCode()));
		result = (int) (prime * result + ((tmoDateModification == null) ? 0 : tmoDateModification.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof TiersModif))
			return false;
		TiersModif equalCheck = (TiersModif) obj;
		if ((tmoTiers == null && equalCheck.tmoTiers != null) || (tmoTiers != null && equalCheck.tmoTiers == null))
			return false;
		if (tmoTiers != null && !tmoTiers.equals(equalCheck.tmoTiers))
			return false;
		if ((tmoNomChampModif == null && equalCheck.tmoNomChampModif != null) || (tmoNomChampModif != null && equalCheck.tmoNomChampModif == null))
			return false;
		if (tmoNomChampModif != null && !tmoNomChampModif.equals(equalCheck.tmoNomChampModif))
			return false;
		if ((tmoDateModification == null && equalCheck.tmoDateModification != null) || (tmoDateModification != null && equalCheck.tmoDateModification == null))
			return false;
		if (tmoDateModification != null && !tmoDateModification.equals(equalCheck.tmoDateModification))
			return false;
		return true;
	}
}
